layui.define(["table", "form"], function (exports) {
    var $ = layui.$,
        table = layui.table,
        form = layui.form;

    table.render({
        elem: "#LAY-adminlog-manage",
        url: "/admin/adminlog/getlist",
        cols: [
            [
                {field: "id", width: 100, title: "ID", sort: true, fixed: "left"},
                {
                    field: "", title: "操作人", width: 120, templet: function (d) {
                        if(d.admin){
                            return d.admin.name;
                        }else if(d.mgruser){
                            return d.mgruser.nick_name
                        }
                        return '';
                    }
                },
                {
                    field: "", title: "操作人ID", width: 100, templet: function (d) {
                        if(d.admin){
                            return d.admin.id;
                        }else if(d.mgruser){
                            return d.mgruser.id
                        }
                        return '';
                    }
                },

                {
                    field: "", title: "被操作人", width: 130, templet: function (d) {
                        return d.user ? d.user.nick_name : '-';
                    }
                },

                {
                    field: "", title: "被操作人ID", width: 120, templet: function (d) {
                        return d.user ? d.user.id : '-';
                    }
                },
                {field: "content", title: "内容"},
                {field: "create_time", title: "操作时间", width: 200},
            ],
        ],
        page: true,
        limit: 20,
        height: "full-140",
        text: "对不起，加载出现异常！",
        even: true,
    });

    exports("adminlog", {});
});
